Skip to content

gh-77589: Add unix domain socket for Windows - #137420

Open
aisk wants to merge 31 commits into
python:mainfrom
aisk:windows-unix-socket
Open

aisk wants to merge 31 commits into
python:mainfrom
aisk:windows-unix-socket

Conversation

@aisk

@aisk aisk commented Aug 5, 2025 •

Copy link
Copy Markdown
Member

Didn't add asyncio support in this PR to avoid too many code changes and keep the review process simpler.

Comment thread PC/pyconfig.h Outdated
@aisk aisk changed the title gh-77589: Windows unix socket gh-77589: Add unix domain socket for Windows Aug 5, 2025
@aisk
aisk requested a review from gpshead as a code owner August 5, 2025 16:12

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of skipping some tests, would not be worth to test a Windows specific behavior?

Some tests can currently be skipped on Windows, but they may work after adding support of AF_UNIX. Please check all currently skipped tests for socket and multiprocessing.

Comment thread Lib/test/test_socket.py Outdated
Comment thread Lib/test/test_socket.py Outdated
Comment thread Lib/test/test_pathlib/test_pathlib.py Outdated
Comment thread Lib/test/test_stat.py Outdated
@serhiy-storchaka
serhiy-storchaka requested a review from zooba August 5, 2025 18:54
@serhiy-storchaka

Copy link
Copy Markdown
Member

It seems that the previous attempt did have more changes in the socket and socketserver modules. Are they no longer relevant?

@aisk

aisk commented Aug 6, 2025

Copy link
Copy Markdown
Member Author

It seems that the previous attempt did have more changes in the socket and socketserver modules. Are they no longer relevant?

The previous attempt modified the socketpair function in the socket module to use AF_UNIX by default on Windows, so it would introduce more changes. I'd like to keep the current behavior to reduce code changes in one PR and compatibility break risk, and we can change it in the future.

The change in socketserver in the previous attempt is mainly because in asyncio's test case, it tries to create an HTTP server over unix domain sockets. On Windows, currently AF_UNIX doesn't support reuse_address, so there needs to be this modification. I changed the test to disable reuse_address on Windows with AF_UNIX. But I think the previous attempt is the right way because users can encounter this issue too. Will update this later today. Thank you for the review!

@aisk
aisk requested a review from vsajip as a code owner August 7, 2025 15:54
@aisk
aisk marked this pull request as draft August 9, 2025 15:21
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 27, 2026
@abel1502

Copy link
Copy Markdown
Contributor

What's the status of this PR? It seems ready for merge, are there any standing issues?

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 15, 2026
@aisk
aisk requested a review from AA-Turner as a code owner June 23, 2026 13:42
@read-the-docs-community

read-the-docs-community Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

@mijioij

mijioij commented Jul 30, 2026

Copy link
Copy Markdown

What's the status of this PR? It seems ready for merge, are there any standing issues?
ditto

@aisk
aisk requested a review from giampaolo as a code owner July 31, 2026 14:28
@winterrdog

Copy link
Copy Markdown

last i checked on AF_UNIX support on windows, microsoft was not willing to fully implement it

from microsoft/WSL#4240 (comment):

Windows implementation of AF_UNIX does not support abstract sockets (as already established here so far) and we have very less desire to implement it since it lacks the Windows security model (abstract unix sockets cannot be secured).

@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 11, 2026
@aisk

aisk commented Oct 11, 2026 •

Copy link
Copy Markdown
Member Author

@winterrdog Abstract sockets are a Linux extension to AF_UNIX; BSD and macOS don't support them either, so it's fine that Windows doesn't. I've added a test to make this behavior explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants